<?php
final class Registry {

    private $data = array();
    private static $instance;

    public function get($key) {
        return (isset($this->data[$key]) ? $this->data[$key] : NULL);
    }

    public function set($key, $value) {
        $this->data[$key] = $value;
    } 
    
    public function __get($name) {
        return $this->data[$name];
    }
    
    
    public function __set($name, $value) {
        
        $this->data[$name] = $value;
    }

    public function has($key) {
        return isset($this->data[$key]);
    }

    private function __construct() {
        
    }
    
    public static function getInstance()
    {
        if(empty(self::$instance))
        {
            self::$instance = new Registry();
        }
        return self::$instance;
    }
}
?>